package com.rfid.a252robot.activity;

import android.app.Activity;
import android.net.http.SslError;
import android.os.Bundle;
import android.webkit.ConsoleMessage;
import android.webkit.PermissionRequest;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import androidx.annotation.Nullable;

import com.rfid.a252robot.R;
import com.rfid.a252robot.base.BaseActivity;
import com.rfid.a252robot.base.BasePresenter;

public class QAActivity extends BaseActivity {
    WebView mWebView;
//    @Override
//    protected int getCountDownTime() {
//        return 0;
//    }
//
//    @Override
//    public BasePresenter getPresenter() {
//        return new BasePresenter();
//    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_qa);
        mWebView = findViewById(R.id.webView);
        mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setDatabaseEnabled(true);
        mWebView.setWebChromeClient(new WebChromeClient());
        mWebView.setWebViewClient(new WebViewClient() {

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                System.out.println("shouldOverrideUrlLoading url = " + url);
                view.loadUrl(url);
                return true;
            }

            @Override
            public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
                System.out.println("onReceivedSslError");
                handler.proceed();
            }
        });
//        mWebView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        mWebView.loadUrl("https://smartqa.clcn.net.cn/robot-clcn/#/?platform=wxnew");
    }

    @Override
    protected int getCountDownTime() {
        return 0;
    }

    @Override
    public BasePresenter getPresenter() {
        return null;
    }
}
